package com.eastfair.venueservice.service.impl;

import com.eastfair.builder.ReportBuilderFeign;
import com.eastfair.builder.vo.ReportBuilderVO;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.venueservice.service.VenueManageReportBuilderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 报馆搭建商基本信息 service.
 *
 * @author dqq
 * @date 2023/3/22
 */
@Service
@Slf4j
public class VenueManageReportBuilderServiceImpl implements VenueManageReportBuilderService {

    @Resource
    private ReportBuilderFeign reportBuilderFeign;

    @Override
    public ReportBuilderVO getByExhibitorId(Long exhibitorId) {
        log.info("getByExhibitorId - 展商ID查询报馆搭建商基本信息, exhibitorId={}", exhibitorId);
        R<ReportBuilderVO> result = reportBuilderFeign.getByExhibitorId(exhibitorId);
        log.info("getByExhibitorId - 展商ID查询报馆搭建商基本信息, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}